
:root {
  --primary-color: #3f63ff;
  --primary-light: rgba(63, 99, 255, 0.1);
  --primary-dark: #2a4fe0;
  --text-color: #1f232b;
  --text-light: #5f6683;
  --bg-color: #ffffff;
  --bg-light: #f5f6fb;
  --border-color: #e1e6f5;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --radius: 10px;
  --shadow: 0 6px 20px rgba(40, 66, 120, 0.08);
}


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text-color);
  background: radial-gradient(circle at top, #fefefe 0%, #eff4ff 45%, #dfe9ff 100%);
  min-height: 100vh;
  padding: 16px;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.right-panels {
  max-height: 100% !important;
}

.panel {
  background: var(--bg-color);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 70vh;
  overflow: hidden;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: 527px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
}

.badge {
  font-size: 12px;
  color: #1d2a62;
  background: rgba(43, 90, 255, 0.08);
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 500;
}


.color-config {
  border: 1.5px solid rgba(31, 68, 183, 0.12);
  border-radius: var(--radius);
  padding: 12px;
  background: linear-gradient(120deg, rgba(76, 123, 255, 0.02), rgba(255, 255, 255, 0.98));
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.color-config-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.color-config-title {
  font-size: 14px;
  font-weight: 600;
}

.color-config-tag {
  font-size: 10px;
  color: #3c4dd6;
  background: rgba(60, 77, 214, 0.08);
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 500;
}

.color-config-body {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.color-picker-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.color-picker-label {
  font-size: 10px;
  color: var(--text-light);
}

.color-picker {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-picker:hover {
  box-shadow: inset 0 0 0 1.5px rgba(63, 99, 255, 0.6);
  transform: scale(1.05);
}

.rgb-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.rgb-input {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  color: #6b7195;
  gap: 3px;
}

.rgb-input input {
  border: 1.5px solid #dde3f5;
  border-radius: 6px;
  padding: 4px;
  font-size: 11px;
  text-align: center;
  transition: border-color 0.2s ease;
  background: #fafbff;
}

.rgb-input input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: #ffffff;
}

.alpha-control {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.alpha-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alpha-range input {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e1e6f5;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.alpha-range input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.alpha-range input::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  background: var(--primary-dark);
}

.alpha-value {
  font-size: 11px;
  color: #3b3f5c;
  min-width: 32px;
  text-align: right;
  font-weight: 500;
}


.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
}

.form-input,
.form-select {
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  padding: 7px 9px;
  font-size: 12px;
  transition: all 0.2s ease;
  background: var(--bg-color);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(63, 99, 255, 0.1);
}


.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-align: center;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(63, 99, 255, 0.25);
}

.btn-secondary {
  background: rgba(63, 99, 255, 0.05);
  color: var(--primary-color);
  border-color: rgba(63, 99, 255, 0.25);
}

.btn-secondary:hover {
  border-color: rgba(63, 99, 255, 0.6);
  color: var(--primary-dark);
  background: rgba(63, 99, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(63, 99, 255, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border-color: var(--border-color);
}

.btn-ghost:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}


.color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  align-content: start;
}

.color-list::-webkit-scrollbar {
  width: 4px;
}

.color-list::-webkit-scrollbar-track {
  background: transparent;
}

.color-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.color-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.color-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(42, 56, 95, 0.08);
  background: #ffffff;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: 100px;
}

.color-item:hover {
  border-color: rgba(63, 99, 255, 0.3);
  box-shadow: 0 2px 8px rgba(63, 99, 255, 0.1);
  transform: translateY(-1px);
}

.color-item.active {
  border-color: var(--primary-color);
  background: rgba(63, 99, 255, 0.04);
  box-shadow: 0 2px 12px rgba(63, 99, 255, 0.15);
}

.color-swatch {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.color-swatch.has-alpha {
  background-image: linear-gradient(45deg, #f6f7ff 25%, transparent 25%, transparent 75%, #f6f7ff 75%, #f6f7ff),
    linear-gradient(45deg, #e4e8ff 25%, transparent 25%, transparent 75%, #e4e8ff 75%, #e4e8ff);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.color-swatch.has-alpha::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--swatch-color, transparent);
}

.color-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.color-code {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.color-type {
  font-size: 10px;
  color: #6b7293;
  text-align: center;
}

.color-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.color-action {
  border: 1px solid rgba(88, 98, 136, 0.15);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  color: #5f6683;
}

.color-action:hover {
  border-color: rgba(63, 99, 255, 0.4);
  color: var(--primary-color);
  background: rgba(63, 99, 255, 0.05);
  box-shadow: 0 2px 6px rgba(63, 99, 255, 0.1);
}

.placeholder {
  width: 100%;
  margin: 0;
  padding: 20px 16px;
  border: 1.5px dashed #d0d8f0;
  border-radius: var(--radius);
  text-align: center;
  color: #9ba0c0;
  font-size: 12px;
  background: rgba(248, 250, 255, 0.5);
}


.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.preview-control {
  display: flex;
  flex-direction: row;
  font-size: 14px;
  color: #5f6683;
  gap: 4px;
}

.preview-control p {
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-control select {
  border-radius: 6px;
  border: 1.5px solid var(--border-color);
  padding: 6px 8px;
  font-size: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-control select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(63, 99, 255, 0.1);
}

.preview-canvas-container {
  position: relative;
  border-radius: var(--radius);
  background: var(--bg-light);
  box-shadow: inset 0 0 0 1px rgba(68, 90, 155, 0.08);
  border: 1px solid rgba(68, 90, 155, 0.05);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

#previewCanvas {
  image-rendering: pixelated;
  background: #ffffff;
  cursor: crosshair;
  display: block;
  width: 100%;
  height: 100%;
}

.preview-active-color {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(42, 56, 95, 0.1);
  background: linear-gradient(125deg, rgba(243, 245, 255, 0.9), #ffffff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-top: 16px;
}

.preview-swatch {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.preview-swatch.has-alpha {
  background-image: linear-gradient(45deg, #f6f7ff 25%, transparent 25%, transparent 75%, #f6f7ff 75%, #f6f7ff),
    linear-gradient(45deg, #e4e8ff 25%, transparent 25%, transparent 75%, #e4e8ff 75%, #e4e8ff);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.preview-swatch.has-alpha::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--swatch-color, transparent);
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.preview-code {
  font-size: 14px;
  color: var(--text-color);
  font-weight: 600;
}

.preview-type {
  font-size: 10px;
  color: #6b7293;
}


.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 38, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 20px;
  width: min(360px, 90vw);
  box-shadow: 0 20px 60px rgba(7, 12, 40, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-hint {
  margin: 0;
  font-size: 12px;
  color: #6f769b;
  line-height: 1.4;
}

.modal-input {
  border-radius: 8px;
  border: 1.5px solid #dfe3f5;
  padding: 8px 10px;
  font-size: 13px;
  transition: border-color 0.2s ease;
  background: #ffffff;
}

.modal-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(63, 99, 255, 0.1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.modal-actions button {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
  min-width: 70px;
}


.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  height: 52px;
  min-height: 52px;
  grid-column: 1 / -1;
}

.tool-title h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.tool-title p {
  font-size: 14px;
  color: var(--text-light);
}

.tool-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  background-color: white;
  padding: 8px 12px;
  font-size: 12px;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  height: calc(100vh - 32px);
  overflow: auto;
}